<template>
  <div style="height:100%;">
    <van-nav-bar title="个人中心" v-model="rgba" :style="rgba[0]" />
    <div class="headers" :style="'background-color:'+rgba[2]">
      <div class="headers_content">
        <van-image width="100" height="100" round lazy-load src="https://i.loli.net/2020/05/31/WoGSJL1aw6xCHIt.jpg" />
        <div class="name_title">
          <p class="p1">昵称:{{fontdatas.userni}}</p>
          <p class="p2">个性签名:{{fontdatas.message}}</p>
        </div>
      </div>  
      <div class="labels">
        <popupone class="poponw"></popupone>
        <popuptow class="poponw"></popuptow>
        <popupthr class="poponw"></popupthr>
        <popupfo class="poponw"></popupfo>
        <van-cell :title="apianuser.info_list[4].name" icon="replay" is-link class="cells" @click="outcan" />
      </div>
    </div>
    <div style="height:50px;width:100%;background-color:#fff"></div>
    <tab-bar></tab-bar>
  </div>
</template>

<script>
//用户页
// import { createNamespacedHelpers } from "vuex";
// const { mapState } = createNamespacedHelpers("apiDataModules");
import popupone from "./components/popupone";
import popuptow from "./components/popuptow";
import popupthr from "./components/popupthr";
import popupfo from "./components/popupfo";
export default {
  name:"user",
  props:{
    userData:Object
  },
  components:{
    popupone,
    popuptow,
    popupthr,
    popupfo,
  },
    data() {
    return {
      show: false,
      num:0,
      apianuser:{},
      rgba:{},
      fontdatas:{
        userni:"name",
        message:"你还没有个性签名"
      }
    };
  },
  created(){
    this.apianuser = JSON.parse(localStorage.getItem("swidata") || [])
    this.font()
  },
  mounted(){
    this.rgba = JSON.parse(localStorage.getItem("bakcColor") || [])
  },
  computed:{
    // ...mapState(["apianuser"])
  },
   methods: {
    showPopup() {
      this.show = true;
    },
    font(){
      let rea = localStorage.getItem("fontdatas")
      if(rea!==null){//如果local里面没有这个数据，就这样消除错误
         this.fontdatas = JSON.parse(localStorage.getItem("fontdatas") || [])
      }
      if(this.fontdatas.message == ''){//没有填写，就默认显示
        this.fontdatas.message = "你还没有个性签名"
      }
      if(this.fontdatas.userni == ''){//没有填写，就默认显示
        this.fontdatas.userni = "name"
      }
    },
    outcan(){
      this.$store.state.apiDataModules.token = ""
      this.$router.push({path:"/"})
    }
  },
  watch:{}
};
</script>

<style lang="scss" scoped>
@import "@/style/user/user.scss";
</style>